package com.robot.member.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.robot.member.pojo.Evaluate;

/**
 * evaluate数据访问接口
 *
 * @author wuyunbin
 */
public interface EvaluateDao extends JpaRepository<Evaluate, String>, JpaSpecificationExecutor<Evaluate> {
    /**
     * 根据companyId查商家下所有评价并分页
     *
     * @param companyId
     * @param pageable
     * @return
     */
    public Page<Evaluate> findAllByCompanyIdAndDeletedAtIsNullOrderByCreatedAtDesc(String companyId, Pageable pageable);

    /**
     * 根据storeId查店铺下所有评价并分页
     *
     * @param storeId
     * @param pageable
     * @return
     */
    public Page<Evaluate> findAllByStoreIdAndDeletedAtIsNullOrderByCreatedAtDesc(String storeId, Pageable pageable);

    /**
     * 根据memberID查找会员名下所有评价并分页
     *
     * @param memberId
     * @param pageable
     * @return
     */
    public Page<Evaluate> findAllByMemberIdAndDeletedAtIsNullOrderByCreatedAtDesc(String memberId, Pageable pageable);

    /**
     * 根据id和memberID查找会员名下某一评价
     *
     * @param id
     * @param memberId
     * @return
     */
    public Evaluate findByIdAndMemberId(String id, String memberId);

    /**
     * 根据ordersId和memberID查找会员名下某一评价
     *
     * @param ordersId
     * @param memberId
     * @return
     */
    public Evaluate findByOrdersIdAndMemberId(String ordersId, String memberId);
}
